package com.crape.common.model;

import com.crape.common.constants.ConstantCode;
import com.crape.common.utils.LabelUtils;
import com.crape.common.utils.StringUtil;

/**
 * 用户文章类
 * 
 * @author ChenKai 2012-11-4 下午12:20:31
 */
public class Article {

    private Long    id;            // ID
    private Long    subjectid;     // 主题ID
    private Long    accountid;     // 创建者accountId
    private String  title;         // 文章标题
    private String  introduction;  // 引言
    private String  content;       // 内容
    private Integer status;        // 状态：0=待发布，1=发布，-1=弃用
    private String  label;         // 标签
    private Long    recommends;    // 推荐数，推荐+1
    private Long    comments;      // 评论数，评论+1，删除评论-1
    private Long 	replys;		   // 回复数，回复+1，删除回复-1
    private Long   	visitors;      // 访问人数，访问+1
    private Long 	views;		   // 浏览量，浏览+1
    private String  imagename;     // 图片名称
    private String  image;         // 原图
    private Integer orderno;       // 序号
    private String  publishdate;   // 发布时间
    private String  createdate;    // 创建时间
    private String  modifydate;    // 修改时间

    // ----------------------------------------------
    private String[] labels;        // 标签
    private Integer optionType = 0; // 操作类型：0=保存，1=修改
    private String  subjectTitle; 	// 主题名称
    private String  username;    	// 创建者名称
    private AccountInfo creator;	// 创建者
    private Integer indexType;		// 首页推荐类型：0=未推荐、1=flash、2=左边、3=右边、-1=不推荐
    private ArticleComment latestArticleComment;
    private Integer isMe; // 状态：0=NO，1=YES

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getSubjectid() {
        return subjectid;
    }

    public void setSubjectid(Long subjectid) {
        this.subjectid = subjectid;
    }

    public Long getAccountid() {
        return accountid;
    }

    public void setAccountid(Long accountid) {
        this.accountid = accountid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getIntroduction() {
        return introduction;
    }
    
    public String getIntroductionHTML() {
        return StringUtil.lineInputHTML(introduction);
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public String getContent() {
        return content;
    }
    
    public String getContentHTML() {
        return StringUtil.lineInputHTML(content);
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

	public Long getRecommends() {
        return recommends;
    }

    public void setRecommends(Long recommends) {
        this.recommends = recommends;
    }

    public Long getComments() {
        return comments;
    }

    public void setComments(Long comments) {
        this.comments = comments;
    }
    
    public Long getReplys() {
		return replys;
	}

	public void setReplys(Long replys) {
		this.replys = replys;
	}

    public Long getVisitors() {
		return visitors;
	}

	public void setVisitors(Long visitors) {
		this.visitors = visitors;
	}

    public Long getViews() {
		return views;
	}

	public void setViews(Long views) {
		this.views = views;
	}

	public String getImagename() {
		return imagename;
	}

	public void setImagename(String imagename) {
		this.imagename = imagename;
	}

	public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

	public String[] getImages() {
		return StringUtil.imagesUrl(imagename, ConstantCode.imageArticleSize);
	}

	public Integer getOrderno() {
        return orderno;
    }

    public void setOrderno(Integer orderno) {
        this.orderno = orderno;
    }

    public String getPublishdate() {
        return publishdate;
    }

    public void setPublishdate(String publishdate) {
        this.publishdate = publishdate;
    }

    public String getCreatedate() {
        return StringUtil.getTimeStr(createdate);
    }

    public void setCreatedate(String createdate) {
        this.createdate = createdate;
    }

    public String getModifydate() {
        return StringUtil.getTimeStr(modifydate);
    }

    public void setModifydate(String modifydate) {
        this.modifydate = modifydate;
    }

    public String[] getLabels() {
		if (label != null) {
			return LabelUtils.getLabels(label, " ");
		}
		return labels;
	}

	public void setLabels(String[] labels) {
		this.labels = labels;
	}

	public Integer getOptionType() {
        return optionType;
    }

    public void setOptionType(Integer optionType) {
        this.optionType = optionType;
    }

	public String getSubjectTitle() {
		return subjectTitle;
	}

	public void setSubjectTitle(String subjectTitle) {
		this.subjectTitle = subjectTitle;
	}

	public AccountInfo getCreator() {
		return creator;
	}

	public void setCreator(AccountInfo creator) {
		this.creator = creator;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Integer getIndexType() {
		return indexType;
	}

	public void setIndexType(Integer indexType) {
		this.indexType = indexType;
	}

	public ArticleComment getLatestArticleComment() {
		return latestArticleComment;
	}

	public void setLatestArticleComment(ArticleComment latestArticleComment) {
		this.latestArticleComment = latestArticleComment;
	}

	public Integer getIsMe() {
		return isMe;
	}

	public void setIsMe(Integer isMe) {
		this.isMe = isMe;
	}

}
